<template>
    <a-sub-menu :key="datas.key" v-bind="$attrs">
        <template #title>
            <span>
                <component :is="$Icon[datas.icon]" />
                <span>{{ datas.title }}</span>
            </span>
        </template>
        <template v-for="item in datas.children" :key="item.key">
            <template v-if="!item.children">
                <a-menu-item :key="item.key">
                    <component :is="$Icon[item.icon]" />
                    <span>{{ item.title }}</span>
                </a-menu-item>
            </template>
            <template v-else>
                <NavSubMenuCC :datas="item" :key="item.key" />
            </template>
        </template>
    </a-sub-menu>
</template>


<script lang="ts">
import { NavMenuJson } from '@/core/NavMenuTreeHelper';
import { defineComponent, PropType } from 'vue'

export default defineComponent({
    name: 'NavSubMenuCC',
    props: {
        datas: {
            type: Object as PropType<NavMenuJson>,
             required: true,
        }
    },
    setup() {
        return {}
    }
})
</script>